<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>P18 1.3.8【案例】改变网页背景色</title>
    <script>
        function color(str) {
            document.body.style.background = str;
        }
    </script>
</head>

<body>
    <input type="button" value="设为红色" onclick="color('red')">
    <input type="button" value="设为黄色" onclick="color('yellow')">
    <input type="button" value="设为蓝色" onclick="color('blue')">
    <input type="button" value="设为自定义色" onclick="color('#00ff00')">
    <a href="../首页/page01.html">
        <h2>返回上一页面</h2>
    </a>
</body>

</html>